$OpenBSD: patch-include_coff_avr_h,v 1.3 2010/06/27 20:58:10 ckuethe Exp $
--- include/coff/avr.h.orig	Sat Jun 26 11:31:17 2010
+++ include/coff/avr.h	Sat Jun 26 11:31:17 2010
@@ -0,0 +1,110 @@
+/* coff information for Atmel AVR.
+   
+   Copyright 2001 Free Software Foundation, Inc.
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2 of the License, or
+   (at your option) any later version.
+   
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+   
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
+
+/* This file was hacked from i860.h */
+
+#define L_LNNO_SIZE 2
+#include "coff/external.h"
+
+/* Bits for f_flags:
+ 	F_RELFLG	relocation info stripped from file
+ 	F_EXEC		file is executable (no unresolved external references)
+ 	F_LNNO		line numbers stripped from file
+ 	F_LSYMS		local symbols stripped from file  */
+
+#define F_RELFLG	(0x0001)
+#define F_EXEC		(0x0002)
+#define F_LNNO		(0x0004)
+#define F_LSYMS		(0x0008)
+/* Upper nibble of flags always needs to be set.  This used to be
+ * undocumented, recent information from Atmel says that bit 7 used to
+ * differentiate between an old vendor-specific deviation of the
+ * format and the current format. */
+#define F_JUNK		(0x00f0)
+#define F_UNUSED	(0xff00)
+
+#define	AVRMAGIC	0xa12
+
+#undef AOUTSZ
+#ifdef AVR_EXT_COFF
+
+/* AVR "extended" COFF format.  This uses the optional header ("a.out"
+   header) to inform the consumer about some additional features that
+   are supported. */
+#define COFF_LONG_FILENAMES yes	/* long filenames supported in consecutive aux entries */
+#define AOUTSZ		28	/* size of optional header in "extended" COFF */
+
+/* Flags in the optional header; they are stored in the vstamp field. */
+#define F_FULLPATHS	0x0001	/* long filenames supported */
+#define F_STRUCTINFO	0x0002	/* structure information contained */
+#define F_PTRINFO	0x0004	/* inter-segment pointers supported */
+
+#else /* old AVR COFF */
+
+#define AOUTSZ		0	/* no a.out for AVR */
+#endif
+
+/* #define AVRAOUTMAGIC	0x406 */ /* "general" magic number of optional header */
+/*
+ * The following magic number causes AVR Studio 4.x to recognize
+ * avr-gcc/GNU binutils produced AVR extended COFF files.  By now,
+ * the only special treatment for them is that the contents of .data
+ * will be appended after .text in the simulator flash.
+ *
+ * 0x9cc has been chosen since it resembles "gcc". ;-)
+ */
+#define AVRAOUTMAGIC	0x9cc	/* "gcc" magic number */
+
+/* By matching not only the magic number, but also the size of the
+   optional a.out header, we can differentiate between both
+   formats. */
+#define AVRBADMAG(x)   ((x).f_magic != AVRMAGIC || (x).f_opthdr != AOUTSZ)
+
+/* AVR COFF has several anomalities in the way the handle the derived
+   type information, and AUX entries, mainly because they apparently
+   didn't bother to learn how COFF is supposed to work before they
+   started.  We fix many of them at the export/import boundary, so all
+   the internal generic COFF handling will work mostly as designed. */
+
+/* NB: these functions are only defined in bfd/coff-avr.c, but also
+   used in coff-ext-avr.c, so the latter can only be configured if the
+   former is also present.  This is certainly always the case
+   anyway. */
+extern void avr_coff_adjust_sym_in_post
+  PARAMS((bfd *, PTR, PTR));
+
+extern void avr_coff_adjust_sym_out_post
+  PARAMS((bfd *, PTR, PTR));
+
+#define COFF_ADJUST_SYM_IN_POST(ABFD, EXT, INT) \
+	avr_coff_adjust_sym_in_post (ABFD, EXT, INT)
+
+#define COFF_ADJUST_SYM_OUT_POST(ABFD, INT, EXT) \
+	avr_coff_adjust_sym_out_post (ABFD, INT, EXT)
+
+/********************** RELOCATION DIRECTIVES **********************/
+
+struct external_reloc
+{
+  char r_vaddr[4];
+  char r_symndx[4];
+  char r_type[2];
+};
+
+#define RELOC struct external_reloc
+#define RELSZ 10
